package com.biz.primus.ms.commodity.dao.po;


import com.biz.primus.ms.base.jpa.po.BaseEntity;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 商品规格参数配置
 *
 * @author david-liu
 * @date 2016年12月16日
 * @reviewer
 * @see
 */
@Data
@Entity
@Table(name = "pro_product_cascade",uniqueConstraints = {@UniqueConstraint(columnNames= {"source_product_id" , "vendor_id"})})
public class ProductCascade extends BaseEntity implements Serializable {

    private static final long serialVersionUID = -7016215207841303508L;

    /**
     * 商家 ID
     */
    @Column(nullable = false,name="vendor_id")
    private Long vendorId;

    /**
     * 关联的源商品
     */
    @JoinColumn(name="source_product_id")
    @ManyToOne(fetch = FetchType.LAZY)
    private Product glProduct;

    /**
     * name
     */
    @Column(name = "cascade_name", length = 50)
    private String name;

    /**
     * 横向检索条件
     */
    @Column(name = "her_condition")
    private String herCondition;

    /**
     * 纵向检索条件
     */
    @Column(name = "ver_condition")
    private String verCondition;

    @Column(length = 50)
    private String value;

    /**
     * 关联商品项
     */

    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
    @JoinColumn(name = "product_cascade_id")
    private List<ProductCascadeItem> items;

}
